function sales_region(){
$.ajax({
type:"GET",
url:"/sales_region",
//dataType:"csv",
success:function(result){
data=result.data
console.log(data)
var region=[],sales=[],profit=[];
	for (i=0;i<data.length;i++){
		region.push(data[i].region)
		sales.push(parseFloat(data[i].sales))
		profit.push(parseFloat(data[i].profit))
	};
	// console.log(region)
	// console.log(sales)
	// console.log(profit)
	var myChart = echarts.init(document.getElementById('data_region'));
	var option;
	myChart.hideLoading();
	option = {
	      tooltip: {
	        // trigger: 'axis',
	        axisPointer: {
	          type: 'shadow',
	          label: {
	            show: true
	          },
	        },

	      },
	      toolbox: {
	        show: true,
	        feature: {
	          mark: { show: true },
	          dataView: { show: true, readOnly: false },
	          magicType: { show: true, type: ['line', 'bar'] },
	          restore: { show: true },
	          saveAsImage: { show: true }
	        }
	      },
	      calculable: true,
	      legend: {
	        data: ['销售额', '利润'],
	        itemGap: 5,
            left: 'left',
			textStyle:{
			  				color:'00F1F3',
			//		  				color:'#2094CA',
			  				fontSize:10,
						},
	      },
	      grid: {
	        top: '12%',
	        left: '1%',
	        right: '10%',
	        containLabel: true
	      },
	      xAxis: [
	        {
	          type: 'category',
	          data: region,
			  axisLabel:{
			  	fontSize:8,
			  	color:'#2094CA',
			  },
	        }
	      ],
	      yAxis: [
	        {
	          type: 'value',
			  axisLabel:{
			  	fontSize:8,
			  	color:'#2094CA',
			  },
	        }
	      ],
	      dataZoom: [
	        {
	          show: true,
	          start: 0,
	          end: 100
	        },
	        {
	          type: 'inside',
	          start: 94,
	          end: 100
	        },
	        {
	          show: true,
	          yAxisIndex: 0,
	          filterMode: 'empty',
	          width: 30,
	          height: '80%',
	          showDataShadow: false,
	          left: '93%'
	        }
	      ],
	      series: [
	        {
	          name: '销售额',
	          type: 'bar',
	          data: sales,

	        },
	        {
	          name: '利润',
	          type: 'bar',
	          data: profit,
			  itemStyle: {
			              color: '#a98b15'
			            }
	        }
	      ]
	    };







	    myChart.setOption(option);



}

});


}









